<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:replace="top::html" />
<link rel="stylesheet" href="/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css" />
<body class="fixed hold-transition skin-blue">
    <div class="wrapper">
        <div th:replace="tophtml::html"></div>
        <div th:replace="left::html"></div>
        <div class="content-wrapper">
            <section class="content-header">
                <div class="audit_k">
					需求详细信息&nbsp;&nbsp;&nbsp;
					<a href="javascript:void(0);selectAnchor('anchor2');" onclick="document.getElementById('anchor2').scrollIntoView()" >需求已匹配信息</a>&nbsp;&nbsp;&nbsp;
					<a href="javascript:void(0);selectAnchor('anchor3');" onclick="document.getElementById('anchor3').scrollIntoView()" >需求未匹配信息</a>&nbsp;&nbsp;&nbsp;
					<a th:if="${not #strings.isEmpty(param.projectId)} and ${#lists.isEmpty(buttDetailList)}" id="matchData" href="javascript:void(0)">
						<input type="hidden" th:value="'demandId='+${demand.pid}+'&demandNumber='+${demand.demandNumber}+'&demandName='+${demand.demandName}+'&projectId='+${project.pid}+'&projectNumber='+${project.projectNumber}+'&projectName='+${project.projectName}">匹配该需求
					</a>
				</div> 
                <ol class="breadcrumb">
                    <li><a th:href="@{/index}"><i class="fa fa-dashboard"></i>用户中心</a></li>
                    <li><a th:href="@{/demand/showQuery}"><i class="fa fa-dashboard"></i>需求管理</a></li>
                    <li><a th:href="@{'/demand/showDetail?demandId='+${demand.pid}}">需求详情</a></li>
                </ol>
            </section>
            <section class="content container-fluid">
                <table id="details" class="table table-bordered" th:object="${demand}">
                	<tbody>
	                    <tr>
	                        <td>需求名称：</td>
	                        <td th:text="*{not #strings.isEmpty(demandName)} and *{#strings.length(demandName)} > 50 ? *{#strings.substring(demandName, 0, 50)}+'...' : *{demandName}" 
	                            th:title="*{demandName}">xxxxx</td>
	                         <td>需求ID：</td>
	                        <td th:text="'D'+*{demandNumber}">xxxxx</td>   
	                            
	                        
	                    </tr>
	                    <tr>
	                    <td>需求内容：</td>
	                        <td th:text="*{not #strings.isEmpty(demandContent)} and *{#strings.length(demandContent)} > 50 ? *{#strings.substring(demandContent, 0, 50)}+'...' : *{demandContent}" 
	                        th:title="*{demandContent}">xxxxx</td>
	                        <td>需求来源：</td>
	                        <td th:text="*{sourceWorth}">xxxxx</td>
	                        
	                    </tr>
	                    <tr>
	                    <td>来源备注：</td>
	                    <td th:text="*{sourceRemark}">xxxxx</td>
	                        <td>需求类型：</td>
	                        <td th:text="*{demandType}">xxxxx</td>
	                        
	                    </tr>
	                    <tr>
	                    <td>领域：</td>
	                        <td th:text="*{researchField}">xxxxx</td>
	                       <!--  <td>国内国外：</td>
	                        <td th:text="*{domesticOrForeign == 0 ? '国内' : '国外'}">xxxxx</td> -->
	                        <td>地区：</td>
	                        <td th:text="*{areaWorth}">xxxxx</td>
	                    </tr>
	                    <tr>
	                        <td>需求状态：</td>
	                        <td th:text="*{demandStatusWorth}">xxxxx</td>
	                         <td>需求单位：</td>
	                        <td th:text="*{demandUnit}">xxxxx</td>
	                    </tr>
	                   <tr>
	                        <td>备注1：</td>
	                        <td th:text="*{remark1}">xxxxx</td>
	                        <td>备注2：</td>
	                        <td th:text="*{remark2}">xxx</td>
	                    </tr>
	                    <tr>
	                        <td>录入人：</td>
	                        <td th:text="${collectPersonName}">xxxxx</td>
	                        <td>录入时间：</td>
	                        <td th:text="*{entryTime}">xxx</td>
	                    </tr>
	                    </tbody>
                	 </table>
                	 <table  class="table table-bordered">
						<tr>
						<td style="text-align: center;font-size: 16px;" colspan="12">
							<b>需求联系人</b>
							<b><a th:with="url=@{/demand/showDetail(demandId=${demand.pid},lookExpert=1,expertId=${person.pid})}" th:href="'javascript:lookExpert(\''+${url}+'\')'">查看联系方式</a></b>
							<input id="lookExpertPwd" type="text" placeholder="输入密码后查看">
						</td>
						</tr>
	                    <tr th:with="isShow=${isLook}==1 and ${isSign}==0">
							<td><label>姓名：</label></td>
							<td th:text="${person.name}" ></td>
							<td><label>手机：</label></td>
							<td th:with="len=${#strings.isEmpty(person.tell)} ? 0 : ${#strings.length(person.tell)}" th:text="${not isShow} and ${len}>4 ? ${#strings.substring(person.tell, 0, len/2-2)}+'****'+${#strings.substring(person.tell, len/2+2, len)} : ${person.tell}"></td>
							<td><label>邮箱：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.email)} and ${#strings.length(person.email)}>4 ? '****'+${#strings.substring(person.email, 4, #strings.length(person.email))} : ${person.email}"></td>
							<td><label>微信：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.wechat)} and ${#strings.length(person.wechat)}>3 ? '***'+${#strings.substring(person.wechat, 3, #strings.length(person.wechat))} : ${person.wechat}"></td>
							<td><label>固定电话：</label></td>
							<td th:with="len=${#strings.isEmpty(person.fixedPhone)} ? 0 : ${#strings.length(person.fixedPhone)}" th:text="${not isShow} and ${len}>4 ? ${#strings.substring(person.fixedPhone, 0, len/2-2)}+'****'+${#strings.substring(person.fixedPhone, len/2+2, len)} : ${person.fixedPhone}"></td>
							<td><label>其他联系方式：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.otherContact)} and ${#strings.length(person.otherContact)}>3 ? '***'+${#strings.substring(person.otherContact, 3, #strings.length(person.otherContact))} : ${person.otherContact}"></td>
						</tr>
                	</table>
                	<!-- <tbody th:object="${person}" class="contact-hide">
						<tr>
							<td><label>专家ID：</label></td>
							<td th:text="'E'+*{expertNumber}"></td>
							<td><label>教育背景：</label></td>
							<td th:text="*{education}"></td>
						</tr>
						<tr>
							<td><label>性别：</label></td>
							<td th:text="${sex == null ? '' : sex == 0 ? '男' : '女'}">男</td>
							<td><label>出生日期：</label></td>
							<td th:text="*{birth}"></td>
						</tr>
						<tr>
							<td><label>籍贯：</label></td>
							<td th:text="*{birthPlace}"></td>
							<td><label>最高学历：</label></td>
							<td th:text="*{maxEducation}"></td>
						</tr>
						<tr>
							<td><label>专家来源：</label></td>
							<td th:text="*{sourceWorth}"></td>
							<td><label>所属领域：</label></td>
							<td th:text="*{researchField}"></td>
						</tr>
						<tr>
							<td><label>毕业院校及所学专业：</label></td>
							<td th:text="*{schoolAndMajor}"></td>
							<td><label>单位：</label></td>
							<td th:text="*{unit}"></td>
						</tr>
						<tr>
							<td><label>职务(职称)：</label></td>
							<td th:text="*{title}"></td>
							<td><label>专业领域：</label></td>
							<td th:text="*{professionaField}"></td>
						</tr>
						<tr>
							<td><label>工作经历：</label></td>
							<td th:text="*{workExp}"></td>
							<td><label>荣誉奖励：</label></td>
							<td th:text="*{honorAward}"></td>
						</tr>
						<tr>
							<td><label>科技成果：</label></td>
							<td th:text="*{technica}"></td>
							<td><label>专家类型：</label></td>
							<td th:text="*{typeWorth}"></td>
						</tr>
						<tr>
							<td><label>国内国外：</label></td>
							<td th:text="*{domesticOrForeign == 0 ? '国内' : '国外'}"></td>
							<td><label>所在地区：</label></td>
							<td th:text="*{areaWorth}"></td>
						</tr>
						<tr>
							<td><label>人才级别：</label></td>
							<td th:text="*{talentLevel}"></td>
							<td><label>附件：</label></td>
							<td><a th:if="${annex}"
								th:href="@{'/person/downloadPerson?fileName='+${annex}}">专家附件</a>
							</td>
						</tr>
						<tr>
							<td><label>备注1：</label></td>
							<td th:text="*{remark1}"></td>
							<td><label>备注2：</label></td>
							<td th:text="*{remark2}"></td>
						</tr>
					</tbody>
					<tr>
						<td colspan="4" style="text-align: center;"><input type="button" id="more" value="更多信息"/></td>
					</tr> -->
               
	            <!-- <div th:if="${person}">
					<div class="menuTitle2 activeTitle2">
						<span id="anchor1"><a id="anchor1">联系人信息</a></span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<table class="table table-bordered" id="details" th:object="${person}">
							<tbody>
								<tr>
									<td><label>专家ID：</label></td>
									<td th:text="'E'+*{expertNumber}"></td>
									<td><label>姓名：</label></td>
									<td th:text="*{name}"></td>
								</tr>
								<tr>
									<td><label>性别：</label></td>
									<td th:text="${sex == null ? '' : sex == 0 ? '男' : '女'}">男</td>
									<td><label>出生日期：</label></td>
									<td th:text="*{birth}"></td>
								</tr>
								<tr>
									<td><label>邮箱：</label></td>
									<td th:text="*{not #strings.isEmpty(email)} ? '****' + *{#strings.substring(email, 4, #strings.length(email))}"></td>
									<td th:text="*{email}"></td>
									<td><label>微信：</label></td>
									<td th:text="*{wechat}"></td>
								</tr>
								<tr>
									<td><label>固定电话：</label></td>
									<td th:text="*{fixedPhone}"></td>
									<td><label>手机：</label></td>
									<td th:text="*{tell}"></td>
								</tr>
							</tbody>
							<tbody style="display: none;">
								<tr>
									<td><label>籍贯：</label></td>
									<td th:text="*{birthPlace}"></td>
									<td><label>最高学历：</label></td>
									<td th:text="*{maxEducation}"></td>
								</tr>
								<tr>
									<td><label>专家来源：</label></td>
									<td th:text="*{sourceWorth}"></td>
									<td><label>所属领域：</label></td>
									<td th:text="*{researchField}"></td>
								</tr>
								<tr>
									<td><label>毕业院校及所学专业：</label></td>
									<td th:text="*{schoolAndMajor}"></td>
									<td><label>单位：</label></td>
									<td th:text="*{unit}"></td>
								</tr>
								<tr>
									<td><label>职务(职称)：</label></td>
									<td th:text="*{title}"></td>
									<td><label>专业领域：</label></td>
									<td th:text="*{professionaField}"></td>
								</tr>
								<tr>
									<td><label>其他联系方式：</label></td>
									<td th:text="*{otherContact}"></td>
									<td><label>教育背景：</label></td>
									<td th:text="*{education}"></td>
								</tr>
								<tr>
									<td><label>工作经历：</label></td>
									<td th:text="*{workExp}"></td>
									<td><label>荣誉奖励：</label></td>
									<td th:text="*{honorAward}"></td>
								</tr>
								<tr>
									<td><label>科技成果：</label></td>
									<td th:text="*{technica}"></td>
									<td><label>专家类型：</label></td>
									<td th:text="*{typeWorth}"></td>
								</tr>
								<tr>
									<td><label>国内国外：</label></td>
									<td th:text="*{domesticOrForeign == 0 ? '国内' : '国外'}"></td>
									<td><label>所在地区：</label></td>
									<td th:text="*{areaWorth}"></td>
								</tr>
								<tr>
									<td><label>人才级别：</label></td>
									<td th:text="*{talentLevel}"></td>
									<td><label>附件：</label></td>
									<td >
		           						<a  th:if="${annex}" th:href="@{'/person/downloadPerson?fileName='+${annex}}">专家附件</a>
		           					</td>
								</tr>
								<tr>
									<td><label>备注1：</label></td>
									<td th:text="*{remark1}"></td>
									<td><label>备注2：</label></td>
									<td th:text="*{remark2}"></td>
								</tr>
							</tbody>
						</table>
						<div class="menuTitle2"></div>
					</div>
				</div> -->
				<div>
					<div class="menuTitle2">
						<span id="anchor2"><a id="anchor2" style="color:black;font-size: 14px; font-weight: bolder;">需求已匹配信息</a></span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<div>
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
									<li class="active">
										<a href="#tab_1" data-toggle="tab" aria-expanded="true">
											<font style="vertical-align: inherit;">需求已匹配项目</font>
										</a>
									</li>
									<li class="">
										<a href="#tab_2" data-toggle="tab" aria-expanded="false">
											<font style="vertical-align: inherit;">需求已匹配专家</font>
										</a>
									</li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active" id="tab_1">
										<table id="buttProject" class="table table-bordered">
											<thead>
												<tr>
													<th>对接介绍</th>
													<th>负责人</th>
													<th>对接时间</th>
													<th>对接状态</th>
													<th>对接详情</th>
													<th>对接附件</th>
													<th>操作</th>
												</tr>
											</thead>
										</table>
									</div>
									<div class="tab-pane" id="tab_2">
										<table id="buttExpert" class="table table-bordered" style="width: 100%">
											<thead>
												<tr>
													<th>对接介绍</th>
													<th>负责人</th>
													<th>对接时间</th>
													<th>对接状态</th>
													<th>对接详情</th>
													<th>对接附件</th>
													<th>操作</th>
												</tr>
											</thead>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div>
					<div class="menuTitle2">
						<span id="anchor3"><a id="anchor3" style="color:black;font-size: 14px; font-weight: bolder;">需求未匹配信息</a></span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<div>
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
									<li class="active">
										<a href="#tab_3" data-toggle="tab" aria-expanded="true">
											<font style="vertical-align: inherit;">需求未匹配项目</font>
										</a>
									</li>
									<li class="">
										<a href="#tab_4" data-toggle="tab" aria-expanded="false">
											<font style="vertical-align: inherit;">需求未匹配专家</font>
										</a>
									</li>
									<li><button id="matching" class="btn btn-primary">匹配</button></li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active" id="tab_3">
										<table id="notButtProject" class="table table-bordered">
											<thead>
												<tr>
													<th><input class="sign" type="checkbox"></th>
													<th>项目id</th>
													<th>项目名称</th>
													<th>项目类型</th>
													<th>项目状态</th>
													<th>匹配</th>
												</tr>
											</thead>
										</table>
									</div>
									<div class="tab-pane" id="tab_4">
										<table id="notButtExpert" class="table table-bordered" style="width: 100%">
											<thead>
												<tr>
													<th><input class="sign" type="checkbox"></th>
													<th>专家ID</th>
													<th>姓名</th>
													<th>专业领域</th>
													<th>匹配</th>
												</tr>
											</thead>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
            </section>
            <a href="#0" class="cd-top cd-is-visible">Top</a>
            <div class="box-footer">
            	<a class="btn btn-primary" th:href="@{'/project/showDemandMatchedProject?pid='+${demand.pid}}">匹配</a>
                <a class="btn btn-primary" th:unless="${demand}" th:href="@{'/demand/showAddContact?demandId='+${demand.pid}}">添加联系人</a>
            	<a class="btn btn-primary" th:href="@{'/demand/showUpdate?demandId='+${demand.pid}}">修改</a>
                <a class="btn btn-primary" href="javascirpt:void(0)" th:onclick="'javascript:subscribe(\''+${demand.pid}+'\',2)'">关注</a>
                <button type="button" class="btn btn-primary" onclick="window.history.go(-1)">返回</button>
            </div>
        </div>
    </div>
    <input id="demandInfo" type="hidden" th:value="'&demandId='+${demand.pid}+'&demandNumber='+${demand.demandNumber}+'&demandName='+${demand.demandName}">
    <div th:replace="footer::html"></div>
    <div class="control-sidebar-bg"></div>
    <div th:replace="bottom::html" ></div>
    <script src="/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
	<script src="/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script type="text/javascript" th:inline="javascript">
		$(function() {
			var table = $("#buttProject").DataTable({
				ajax : {
					url : [[@{/demand/queryProjectButtDetail}]],
					dataSrc : "",
					data : {demandId : [[${demand.pid}]]}
				},
				columns : [
					{data : "remark2"},
					{data : "buttName"},
					{data : "buttDataTime"},
					{data : "buttStatusWorth"},
					{data : "buttDetails"},
					{data : "buttaNnex",
						render : function(data, type, row, meta) {
							if (data !== null && data !== undefined) {
								return "<a href=/details/download?fileName="+data+">对接附件</a>";
							} else {
								return "";
							}
							
						}},
					{data : "pid", 
						render : function(data, type, row, meta) {
							return "<a href=/details/showDemandMatchProjectAddButt1?detailPid="+data+">更新对接详情</a>|<a href=/details/showDemandMatchProjectHistoryButts1?buttdetails="+data+"&pid="+[[${demand.pid}]]+">查看历史详情</a>"; 
						}}
				],
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
			var table1 = $("#buttExpert").DataTable({
				ajax : {
					url : [[@{/demand/queryExpertButtDetail}]],
					dataSrc : "",
					data : {demandId : [[${demand.pid}]]}
				},
				columns : [
					{data : "remark2"},
					{data : "buttName"},
					{data : "buttDataTime"},
					{data : "buttStatusWorth"},
					{data : "buttDetails"},
					{data : "buttaNnex",
						render : function(data, type, row, meta) {
							if (data !== null && data !== undefined) {
								return "<a href=/details/download?fileName="+data+">对接附件</a>";
							} else {
								return "";
							}
						}},
					{data : "pid", 
						render : function(data, type, row, meta) {
							return "<a href=/details/showDemandMatchExpertAddButt1?detailPid="+data+">更新对接详情</a>|<a href=/details/showDemandMatchExpertHistoryButts1?buttdetails="+data+"&pid="+[[${demand.pid}]]+">查看历史详情</a>"; 
						}}
				],
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
			var table2 = $("#notButtProject").DataTable({
				ajax : {
					url : [[@{/demand/notButtProject}]],
					dataSrc : "",
					data : {demandId : [[${demand.pid}]]}
				},
				columns : [
					{data : "projectId",
						render : function(data, type, row, meta) {
							var projectInfo = "projectId="+data+"&projectNumber="+row.projectNumber.replace("R", "")+"&projectName="+row.projectName;
							var buttInfo = projectInfo + $("input#demandInfo").val();
							if (data !== null && data != undefined) {
								return "<input type='checkbox' class='matched' value="+buttInfo+">";
							} else {
								$("#all").prop("disabled", true);
								return "<input id='"+row.projectNumber+"' disabled type='checkbox' class='matched' value="+buttInfo+">";
							}
						}},
					{data : "projectNumber",
						render : function(data, type, row, meta) {
							return "<a href=/project/showDetail?projectId="+row.projectId+">"+data+"</a>";
						}},
					{data : "projectName", 
						render : function(data, type, row, meta) {
							if (data.length > 20)
								return "<span title='"+data+"'>"+data.substring(0, 20)+"...</span>";
							return "<span title='"+data+"'>"+data+"</span>";
						}},
					{data : "projectType"},
					{data : "projectStatus"},
					{data : "projectId",
						render : function(data, type, row, meta) {
							if (data !== null && data != undefined) {
								return "<a href='javascript:void(0);' onclick='demandMatchProject(this)'>匹配</a>";
							} else {
								return "<a href=javascript:void(0);>匹配</a>";
							}			
						}
					}
				],
				initComplete: function(settings, json) {
					$(":checkbox:disabled").closest("tr").addClass("butt-gray");
				},
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
			var table3 = $("#notButtExpert").DataTable({
				ajax : {
					url : [[@{/demand/notButtExpert}]],
					dataSrc : "",
					data : {demandId : [[${demand.pid}]]}
				},
				columns : [
					{data : "expertId",
						render : function(data, type, row, meta) {
							var expertInfo = "expertId="+data+"&expertNumber="+row.expertNumber.replace("E", "")+"&name="+row.name;
							var buttInfo = expertInfo + $("input#demandInfo").val();
							if (data !== null && data != undefined) {
								return "<input type='checkbox' class='matched' value="+buttInfo+">";
							} else {
								$("#all").prop("disabled", true);
								return "<input id='"+row.expertNumber+"' disabled type='checkbox' class='matched' value="+buttInfo+">";
							}
						}},
					{data : "expertNumber",
						render : function(data, type, row, meta) {
							return "<a href=/person/personDetails?pid="+row.expertId+">"+data+"</a>";
						}},
					{data : "name"},
					{data : "professionaField",
						render : function(data, type, row, meta) {
							if (data.length > 50)
								return "<span title='"+data+"'>"+data.substring(0, 50)+"...</span>";
							return "<span title='"+data+"'>"+data+"</span>";
						}},
					{data : "expertId",
						render : function(data, type, row, meta) {
							if (data !== null && data != undefined) {
								return "<a href=javascript:void(0); onclick=demandMatchExpert(this)>匹配</a>";
							} else {
								return "<a href=javascript:void(0);>匹配</a>";
							}
						}
					}
				],
				initComplete: function(settings, json) {
					$(":checkbox:disabled").closest("tr").addClass("butt-gray");
				},
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
		});
		$("#matching").click(function() {
			var href = $(this).closest("ul").find("li.active a").attr("href");
			if (href === "#tab_3")
				matching([[@{/project/demandMatchProject}]]);
			else if (href === "#tab_4")
				matching([[@{/person/demandMatchExpert}]]);
		});
		
        function demandMatchProject(tag) {
	        $(tag).closest("tr").find(":checkbox").prop("checked", true);
	        matching([[@{/project/demandMatchProject}]]);
        	$(tag).removeAttr("onclick");
        }
        function demandMatchExpert(tag) {
	        $(tag).closest("tr").find(":checkbox").prop("checked", true);
	        matching([[@{/person/demandMatchExpert}]]);
        	$(tag).removeAttr("onclick");
        }
        $("#matchData").one("click", function() {
        	var data = $(this).find("input").val();
        	matchWithData([[@{/demand/projectMatchDemand}]], data);
        });
	</script>
</body>

</html>